package com.szzg10.thinking.chapter18;

import java.nio.ByteBuffer;

public class GetData {

	public static void main(String[] args) {
		ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
		
		//char
		byteBuffer.asCharBuffer().put("Howdy!");
		char ch;
		while((ch = byteBuffer.getChar()) != 0) {
			System.out.print(ch);
		}
		
		System.out.println();
		
		//short
		byteBuffer.rewind();
		byteBuffer.asShortBuffer().put((short)12390);
		System.out.println(byteBuffer.getShort());
		
		//int
		byteBuffer.rewind();
		byteBuffer.asIntBuffer().put(99471142);
		System.out.println(byteBuffer.getInt());
		
		//long
		
		//float
		
		//double
		
	}
}
